package com.jinbo.sxzq;

import android.graphics.Canvas;
import android.view.SurfaceHolder;

public class GameControlThread extends Thread{
    GameControl gameControl;
    private int sleepSpan = 800;//每0.8s执行一次
    private boolean flag = true;//标志位(表示游戏正在执行)
    public GameControlThread(GameControl gameControl){//构造函数
        this.gameControl = gameControl;
    }
    public void  run(){
        while (flag){//开始刷新
            try{//睡眠
                Thread.sleep(sleepSpan);
            }catch (Exception e){
                e.printStackTrace();
            }
            gameControl.PlayGame();
        }
    }
    public void setFlag(boolean flag){
        this.flag = flag;
    }
}
